package cn.day12;

import java.util.Scanner;

/*正则表达式*/
public class TestRegex {
    public static void main(String[] args) {
        String regex="\\d{17}[0-9X]";
        String input;
        do{
            System.out.println("请输入您的身份证号");
            input=new Scanner(System.in).nextLine();
            if(input.matches(regex)){
                System.out.println("输入正确");
                return;
            }
        }while (!input.matches(regex));
    }
}
